﻿using System.Collections.Generic;
using System.Linq;

namespace GameLogic.Poker
{
    public class HandGenerator
    {
        private readonly ICombinationGenerator combinationGenerator;

        public HandGenerator(ICombinationGenerator combinationGenerator)
        {
            this.combinationGenerator = combinationGenerator;
        }

        public List<Hand> GenerateFromTwoFive(IEnumerable<Card> playerCards,IEnumerable<Card> desk)
        {
            var hands = new List<Hand>();
            var combinations= combinationGenerator.Generate(playerCards,desk);
            hands.AddRange(combinations.Select(combination => new Hand(new List<Card>(combination.Cards))));
            return hands;
        }
    }
}